﻿$(document).ready(function () {
    $('select[select_file]').change(function () {
        var selectfile = $('select[name=' + $(this).attr('select_file') + ']')
        selectfile.children().remove();
        var loc = document.location.href;
        if (loc.indexOf('?') > 0) loc += '&'; else loc += '?';
        loc += 'getFiles=' + $(this).val();
        $.ajax({
            type: "POST",
            url: loc,
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                for (var file in msg) {
                    selectfile.append('<option value="' + file + '">' + msg[file] + '</option>')
                }
            }
        });
    });
});